public class Hanruoyi {


    public static void main(String[] args) {

        System.out.println("汉若依石砖");

        Rule r =new Rule();
        r.move(5,'A','B','C');



    }


}

class Rule{

    public void  move(int num ,char a,char b,char c){
        if(num == 1){
            System.out.println("第"+num+"步，从"+a+"->"+c);
        }else{
            move(num-1 ,a,c,b);
            System.out.println("第"+num+"步，从"+a+"->"+c);
            move(num-1 ,b,a,c);
        }

    }
}